package com.sx.micowell.framework.model

import androidx.databinding.ObservableField
import androidx.lifecycle.MutableLiveData
import com.example.mvvm.base.data.MutableLiveListData
import com.example.mvvm.base.vm.BaseViewModel
import com.example.mvvm.until.LogUtils
import com.example.mvvm.until.SPUtils
import com.example.mvvm.until.ToastUtils
import com.miloyu.modelnet.cache.CacheManager
import com.miloyu.modelnet.network.ApiResponse
import com.miloyu.modelnet.network.BaseResponse
import com.miloyu.modelnet.network.HttpClient
import com.miloyu.modelnet.network.service.IApiService
import com.miloyu.modelnet.network.tools.RxUtils
import com.miloyu.modelnet.response.AppBanner
import com.miloyu.modelnet.response.TokenVO
import com.miloyu.modelnet.response.UserInfoVO
import com.sx.micowell.framework.app.SPKey

/**
 * @Description
 * @Author 梁浩文
 * @Date 2021/7/27 9:24
 */
class HomeModel :BaseViewModel() {
    var refreshLiveData:MutableLiveData<Boolean> = MutableLiveData()

    var tabData:MutableLiveListData<String> = MutableLiveListData()

    var homeVideoData: MutableLiveData<AppBanner> =MutableLiveData();

    fun initTab(){
         MutableLiveListData.Builder(tabData)
             .add("全部")
             .add("上个月")
             .add("上周")
             .buildPost()
    }

    fun reqHomeVideo(){
        HttpClient.instance.create(IApiService::class.java)
            .getHomeVideo()
            .compose(RxUtils.compose())
            .subscribe(object: ApiResponse<AppBanner>(){
                override fun success(data: AppBanner?, msg: String?) {
                    homeVideoData.postValue(data)
                }

                override fun onFail(e: Throwable?, errorMsg: String?) {
                }
            })
    }


}